<?php

use App\Http\Controllers\Api\AdMonitorController;
use App\Http\Controllers\Api\AdPostbackVirtualController;
use App\Http\Controllers\Api\FirstupController;
use App\Http\Controllers\Api\H5ToApkController;
use App\Http\Controllers\Api\LogController;
use App\Http\Controllers\Api\LoginController;
use App\Http\Controllers\Api\PayController;
use App\Http\Controllers\Api\PhoneCodeController;
use App\Http\Controllers\Api\StartController;
use App\Http\Controllers\Api\SwitchPayController;
use App\Http\Controllers\Api\SysController;
use App\Http\Controllers\Api\UserRoleController;
use App\Http\Controllers\Api\WxMessageController;
use App\Http\Controllers\Api\WxController;
use App\Http\Controllers\Api\AdviewController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

// 系统内部通讯接口

Route::any('sys/budan', [SysController::class, 'budan']);
Route::any('sys/account_pwd_update', [SysController::class, 'userAccountPasswordUpdate']);

// 切支付callback
Route::any('switch_pay/callback/{pay_platform}/{game_channel_id}', [SwitchPayController::class, 'callback']);

/*
|--------------------------------------------------------------------------
| 聚合安卓
|--------------------------------------------------------------------------
*/
Route::any('user/firstup', [FirstupController::class, 'firstup']);
Route::any('user/start_up', [StartController::class, 'startUp']);
Route::any('policy/choose', [StartController::class, 'agreePolicy']);
Route::any('user/login', [LoginController::class, 'login']);
Route::any('pay/create', [PayController::class, 'create']);
Route::any('pay/callback/{game_channel_id}', [PayController::class, 'callback']);
Route::any('pay/client_callback/{game_channel_id}', [PayController::class, 'callbackToClient']);
Route::any('pay/orders_call_client', [PayController::class, 'orderCallClient']);
Route::any('log/{game_channel_id}', [LogController::class, 'log']);
Route::any('log/adview', [LogController::class, 'logAdview']);
Route::any('adview/callback', [AdviewController::class, 'callback']);

Route::any('role/reg', [UserRoleController::class, 'reg']);
Route::any('role/login', [UserRoleController::class, 'login']);
Route::any('role/level_up', [UserRoleController::class, 'levelUp']);
Route::any('role/event', [UserRoleController::class, 'event']);

/*
|--------------------------------------------------------------------------
| H5
|--------------------------------------------------------------------------
*/
Route::any('h5/user/firstup', [FirstupController::class, 'firstup']);
Route::any('h5/user/login', [LoginController::class, 'login']);
Route::any('h5/pay/create', [PayController::class, 'create']);
Route::any('h5/msg/check', [WxMessageController::class, 'msgCheck']);
Route::any('h5/pay/callback/{game_channel_id}', [PayController::class, 'callback']);
Route::any('h5/pay/client_callback/{game_channel_id}', [PayController::class, 'callbackToClient']);
Route::any('h5/log/{game_channel_id}', [LogController::class, 'log']);
Route::any('h5/toapk/check', [H5ToApkController::class, 'canSwitch']);
Route::any('h5/toapk/token_account', [H5ToApkController::class, 'getAccountByToken']);

// 游戏角色注册登录
Route::any('h5/role/reg', [UserRoleController::class, 'reg']);
Route::any('h5/role/login', [UserRoleController::class, 'login']);
Route::any('h5/role/level_up', [UserRoleController::class, 'levelUp']);
Route::any('h5/role/event', [UserRoleController::class, 'event']);


/*
|--------------------------------------------------------------------------
| 官包
|--------------------------------------------------------------------------
*/
Route::controller(App\Http\Controllers\Api\JuheH5\AccountController::class)->group(function () {
    Route::any('juheh5/account/login_test', 'loginTest');
    Route::any('juheh5/account/fast_reg', 'fastReg');                //快速注册
    Route::any('juheh5/account/phone_reg', 'phoneReg');              //手机注册
    Route::any('juheh5/account/account_reg', 'accountReg');          //账号注册
    Route::any('juheh5/account/phone_login', 'phoneLogin');          //手机登录
    Route::any('juheh5/account/account_login', 'accountLogin');      //账号登录
    Route::any('juheh5/account/token_login', 'tokenLogin');          //令牌登录
    Route::any('juheh5/account/idcard_auth', 'idcardAuthenticate');  //实名认证
    Route::any('juheh5/account/phone_bind', 'phoneBind');            //绑定手机
    Route::any('juheh5/account/phone_unBind', 'phoneUnbind');        //解绑手机
    Route::any('juheh5/account/pass_retrieve', 'passwordRetrieve');  //找回密码
});

Route::any('ad/monitor_url', [AdMonitorController::class, 'monitorUrl']);
Route::any('ad/monitor', [AdMonitorController::class, 'mediaMonitor']);

Route::any('phone_code/get', [PhoneCodeController::class, 'get']);

Route::any('ad/postback_virtual/report', [AdPostbackVirtualController::class, 'report']);

// H5 WanSdk
Route::controller(App\Http\Controllers\Api\WanSdkController::class)->group(function () {
    Route::any('h5sdk/get_account_info', 'getAccountInfo');
});

/*
|--------------------------------------------------------------------------
| 微信公众号相关
|--------------------------------------------------------------------------
*/
Route::any('wx/cb/{appid}', [WxController::class, 'cb']);
Route::any('wx/menu/create/{appid}', [WxController::class, 'menuCreate']);
Route::any('wx/material/batch_get/{appid}', [WxController::class, 'MaterialBatchGet']);
Route::any('wx/qrcode/create/{appid}', [WxController::class, 'qrcodeCreate']);

/*
|--------------------------------------------------------------------------
| 小程序相关
|--------------------------------------------------------------------------
*/
Route::controller(App\Http\Controllers\Api\MiniprogramToGame\StartController::class)->group(function () {
    Route::any('mtg/start/index', 'index');
});
Route::controller(App\Http\Controllers\Api\MiniprogramToGame\PokemonVoteController::class)->group(function () {
    Route::any('mtg/vote/index', 'index');
    Route::any('mtg/vote/vote', 'vote');
});

Route::controller(App\Http\Controllers\Api\WxMiniprogramController::class)->group(function () {
    Route::any('wx/miniprogram/uc_scheme', 'ucGenerateScheme');
    Route::any('wx/miniprogram/baidu_scheme', 'baiduGenerateScheme');
    Route::any('wx/miniprogram/url_scheme', 'generateUrlScheme');
    Route::any('wx/miniprogram/url_link', 'generateUrllink');
});

Route::controller(App\Http\Controllers\Api\WxMiniprogramMessageController::class)->group(function () {
    Route::any('wx/miniprogram/message/cb/{appid}', 'messageCb');
});


/*
|--------------------------------------------------------------------------
| 小游戏相关
|--------------------------------------------------------------------------
*/
Route::controller(App\Http\Controllers\Api\MiniToGame\StartController::class)->group(function () {
    Route::any('mgtg/start/index', 'index');
});

Route::controller(App\Http\Controllers\Api\WxMinigameMessageController::class)->group(function () {
    Route::any('wx/minigame/kefu/message/{appid}', 'message');
});

/*
|--------------------------------------------------------------------------
| 我方后端研发前端
|--------------------------------------------------------------------------
*/
Route::any('yfsdk/user/firstup', [FirstupController::class, 'firstup']);
Route::any('yfsdk/user/login', [LoginController::class, 'login']);
Route::any('yfsdk/pay/create', [PayController::class, 'create']);
Route::any('yfsdk/role/reg', [UserRoleController::class, 'reg']);
Route::any('yfsdk/role/login', [UserRoleController::class, 'login']);
Route::any('yfsdk/role/xuni_pay', [UserRoleController::class, 'xuniPay']);
